InternalAssessForm = Ext.extend(Ext.Window, {
    constructor : function(a) {
        Ext.apply(this, a);
        this.initUIComponents();
        InternalAssessForm.superclass.constructor.call(this, {
            id : 'InternalAssessForm',
            title : '内部自评',
            layout : 'fit',
            modal : true,
            items : yearGridFormPanel,
            buttons : yearGridFormButtons,
            iconCls : "menu-flowWait",
            width : 620,
            height : 375,
            buttonAlign : 'center',
            buttonStyle : 'padding:2px;'
        })
    },
    initUIComponents : function() {
        createyeargridform({
            operation : this,
            form : {
                saveUrl : __ctxPath + "/safeachievements/saveInternalAssess.do",
                items : [ {
                    id : "internalAssess.id",
                    name : "internalAssess.id",
                    xtype : "hidden",
                    value : this.id == null ? "" : this.id
                }, {
                    name : "internalAssess.years",
                    xtype : "hidden",
                    id : "internalAssess.years",
                    value : this.years == null ? "" : this.years
                }, {
                    layout : 'column',
                    bodyStyle : "padding:5px;",
                    border : false,
                    items : [ {
                        layout : 'form',
                        bodyStyle : 'padding:5px;',
                        columnWidth : .5,
                        border : false,
                        items : [ {
                            xtype : 'combo',
                            fieldLabel : '所属机构',
                            hiddenName : 'internalAssess.institution',
                            mode : 'local',
                            editable : false,
                            width : 146,
                            triggerAction : 'all',
                            store : new Ext.data.ArrayStore({
                                id : 0,
                                fields : [ 'id', 'type' ],
                                data : [ [ "1", "组织部" ], [ "2", "财务部" ], [ "3", "销售部" ] ]
                            }),
                            valueField : 'type',
                            displayField : 'type',
                            value : '销售部'
                        } ]
                    }, {
                        layout : 'column',
                        bodyStyle : 'padding:5px;',
                        columnWidth : .5,
                        border : false,
                        items : [ {
                            columnWidth : .7,
                            layout : "form",
                            border : false,
                            items : [ {
                                xtype : 'hidden',
                                name : 'internalAssess.ratingProjectSetTreeId',
                                readOnly : true,
                                width : 0,
                                maxLength : 200
                            }, {
                                xtype : 'textfield',
                                fieldLabel : '自评项目模板名称',
                                name : 'internalAssess.ratingProjectSetTreeName',
                                readOnly : true,
                                width : 146,
                                maxLength : 200
                            } ]
                        }, {
                            columnWidth : .3,
                            layout : "form",
                            border : false,
                            items : [ {
                                text : '选择',
                                width : 55,
                                xtype : 'button',
                                handler : function() {
                                    SingleTreeEject.getView({
                                        callback : function(records) {
                                            var internalAssessFormVal = yearGridFormPanel.getForm();
                                            internalAssessFormVal.findField("internalAssess.ratingProjectSetTreeId").setValue(eval(records).id);
                                            internalAssessFormVal.findField("internalAssess.ratingProjectSetTreeName").setValue(eval(records).text)
                                        },
                                        multiSel : false,
                                        select : true,
                                        winId : 'RatingProjectSetTreeInfoWin',
                                        winTitle : '自评项目信息查看',
                                        winWidth : 400,
                                        winHeight : 400,
                                        winListurl : __ctxPath + "/safeachievements/getAllRatingProjectSetTree.do",
                                        winFields : [ "id", 'internalName', 'internalDesc' ],
                                        columnModel : [ {
                                            header : "id",
                                            dataIndex : "id",
                                            hidden : true
                                        }, {
                                            header : "名称",
                                            dataIndex : "internalName",
                                            width : 50,
                                            hidden : false,
                                            sortable : true
                                        }, {
                                            header : "描述",
                                            dataIndex : 'internalDesc',
                                            width : 100
                                        } ]
                                    }).show();
                                }
                            } ]
                        } ]
                    }, {
                        layout : "form",
                        bodyStyle : 'padding:5px;',
                        border : false,
                        columnWidth : .5,
                        items : [ {
                            xtype : 'datefield',
                            width : 146,
                            fieldLabel : '自评开始时间<font color="red">*</font>',
                            name : 'internalAssess.startReviewDate',
                            allowBlank : false,
                            format : 'y-m-d',
                            maxLength : 100
                        } ]
                    }, {
                        layout : 'form',
                        bodyStyle : 'padding:5px;',
                        border : false,
                        columnWidth : .5,
                        items : [ {
                            xtype : 'datefield',
                            fieldLabel : '自评结束时间<font color=\'red\'>*</font>',
                            name : 'internalAssess.endReviewDate',
                            width : 146,
                            allowBlank : false,
                            format : 'y-m-d',
                            maxLength : 200
                        } ]
                    }, {
                        layout : 'form',
                        bodyStyle : 'padding:5px;',
                        border : false,
                        columnWidth : .5,
                        items : [ {
                            xtype : 'textfield',
                            name : 'internalAssess.groupLeader',
                            fieldLabel : '自评组组长',
                            width : 146,
                            maxLength : 100
                        } ]
                    }, {
                        layout : 'form',
                        bodyStyle : 'padding:5px;',
                        border : false,
                        columnWidth : .5,
                        items : [ {
                            xtype : 'textfield',
                            name : 'internalAssess.inputName',
                            fieldLabel : '自评填写人',
                            width : 146
                        } ]
                    } ]
                }, {
                    layout : 'column',
                    bodyStyle : "padding:5px;",
                    border : false,
                    items : [ {
                        layout : "form",
                        bodyStyle : "padding:5px;",
                        columnWidth : 1.,
                        items : [ {
                            xtype : "textarea",
                            fieldLabel : '自评组主要成员',
                            name : 'internalAssess.groupMember',
                            width : 448,
                            maxLength : 2000
                        } ]
                    } ]
                }, {
                    layout : 'column',
                    bodyStyle : "padding:5px;",
                    border : false,
                    items : [ {
                        layout : 'form',
                        bodyStyle : "padding:5px;",
                        columnWidth : 1.,
                        items : [ {
                            xtype : 'textarea',
                            fieldLabel : '备注',
                            name : 'internalAssess.remark',
                            width : 448,
                            maxLength : 1000
                        } ]
                    } ]
                } ]
            },
            loadData : {
                getUrl : __ctxPath + "/safeachievements/getInternalAssess.do",
                preName : "internalAssess"
            }
        });
    }
});